libname in 'd:\local_c\bfeed3';

*for restat, Breastfeeding and Children's Early Cognitive Outcomes. Continuation from work08.sas, now start forming variables;
**work08.sas merges mother labor force data with child data;

data in.work082;
set in.work08;
drop w0000100-w9999900;

**note that s is the status array as defined in codebook;
**h is the hours array as defined in codebook;

**so let's just try to array all of the workhistory info.;
array s(1618)  
W0061300 W0061400 W0061500 W0061600 W0061700 W0061800 W0061900 W0062000 W0062100 
W0062200 W0062300 W0062400 W0062500 W0062600 W0062700 W0062800 W0062900 W0063000 
W0063100 W0063200 W0063300 W0063400 W0063500 W0063600 W0063700 W0063800 W0063900 
W0064000 W0064100 W0064200 W0064300 W0064400 W0064500 W0064600 W0064700 W0064800 
W0064900 W0065000 W0065100 W0065200 W0065300 W0065400 W0065500 W0065600 W0065700
W0065800 W0065900 W0066000 W0066100 W0066200 W0066300 W0066400 W0066500
/*1978 up to week 53*/
W0066600 W0066700 W0066800 W0066900 W0067000 W0067100 W0067200 W0067300 W0067400
W0067500 W0067600 W0067700 W0067800 W0067900 W0068000 W0068100 W0068200 W0068300 
W0068400 W0068500 W0068600 W0068700 W0068800 W0068900 W0069000 W0069100 W0069200 
W0069300 W0069400 W0069500 W0069600 W0069700 W0069800 W0069900 W0070000 W0070100 
W0070200 W0070300 W0070400 W0070500 W0070600 W0070700 W0070800 W0070900 W0071000 
W0071100 W0071200 W0071300 W0071400 W0071500 W0071600 W0071700
/*1979 up to week 105*/
W0106500 W0106600 W0106700 W0106800 W0106900 W0107000 W0107100 W0107200 W0107300 
W0107400 W0107500 W0107600 W0107700 W0107800 W0107900 W0108000 W0108100 W0108200 
W0108300 W0108400 W0108500 W0108600 W0108700 W0108800 W0108900 W0109000 W0109100 
W0109200 W0109300 W0109400 W0109500 W0109600 W0109700 W0109800 W0109900 W0110000 
W0110100 W0110200 W0110300 W0110400 W0110500 W0110600 W0110700 W0110800 W0110900 
W0111000 W0111100 W0111200 W0111300 W0111400 W0111500 W0111600 
/*1980 up to week 157*/
W0146400 W0146500 W0146600 W0146700 W0146800 W0146900 W0147000 W0147100 W0147200 
W0147300 W0147400 W0147500 W0147600 W0147700 W0147800 W0147900 W0148000 W0148100 
W0148200 W0148300 W0148400 W0148500 W0148600 W0148700 W0148800 W0148900 W0149000 
W0149100 W0149200 W0149300 W0149400 W0149500 W0149600 W0149700 W0149800 W0149900 
W0150000 W0150100 W0150200 W0150300 W0150400 W0150500 W0150600 W0150700 W0150800 
W0150900 W0151000 W0151100 W0151200 W0151300 W0151400 W0151500
/*1981 up to week 209*/
W0186300 W0186400 W0186500 W0186600 W0186700 W0186800 W0186900 W0187000 W0187100
W0187200 W0187300 W0187400 W0187500 W0187600 W0187700 W0187800 W0187900 W0188000 
W0188100 W0188200 W0188300 W0188400 W0188500 W0188600 W0188700 W0188800 W0188900 
W0189000 W0189100 W0189200 W0189300 W0189400 W0189500 W0189600 W0189700 W0189800 
W0189900 W0190000 W0190100 W0190200 W0190300 W0190400 W0190500 W0190600 W0190700 
W0190800 W0190900 W0191000 W0191100 W0191200 W0191300 W0191400 
/*1982 up to week 261*/
W0226200 W0226300 W0226400 W0226500 W0226600 W0226700 W0226800 W0226900 W0227000
W0227100 W0227200 W0227300 W0227400 W0227500 W0227600 W0227700 W0227800 W0227900 
W0228000 W0228100 W0228200 W0228300 W0228400 W0228500 W0228600 W0228700 W0228800 
W0228900 W0229000 W0229100 W0229200 W0229300 W0229400 W0229500 W0229600 W0229700 
W0229800 W0229900 W0230000 W0230100 W0230200 W0230300 W0230400 W0230500 W0230600 
W0230700 W0230800 W0230900 W0231000 W0231100 W0231200 W0231300 
/*1983 up to week 313*/
W0266600 W0266700 W0266800 W0266900 W0267000 W0267100 W0267200 W0267300 W0267400 
W0267500 W0267600 W0267700 W0267800 W0267900 W0268000 W0268100 W0268200 W0268300 
W0268400 W0268500 W0268600 W0268700 W0268800 W0268900 W0269000 W0269100 W0269200 
W0269300 W0269400 W0269500 W0269600 W0269700 W0269800 W0269900 W0270000 W0270100 
W0270200 W0270300 W0270400 W0270500 W0270600 W0270700 W0270800 W0270900 W0271000 
W0271100 W0271200 W0271300 W0271400 W0271500 W0271600 W0271700 W0271800 
/*1984 up to week 366*/
W0306600 W0306700 W0306800 W0306900 W0307000 W0307100 W0307200 W0307300 W0307400 
W0307500 W0307600 W0307700 W0307800 W0307900 W0308000 W0308100 W0308200 W0308300 
W0308400 W0308500 W0308600 W0308700 W0308800 W0308900 W0309000 W0309100 W0309200 
W0309300 W0309400 W0309500 W0309600 W0309700 W0309800 W0309900 W0310000 W0310100 
W0310200 W0310300 W0310400 W0310500 W0310600 W0310700 W0310800 W0310900 W0311000 
W0311100 W0311200 W0311300 W0311400 W0311500 W0311600 W0311700 
/*1985 up to week 418*/
W0346500 W0346600 W0346700 W0346800 W0346900 W0347000 W0347100 W0347200 W0347300 
W0347400 W0347500 W0347600 W0347700 W0347800 W0347900 W0348000 W0348100 W0348200 
W0348300 W0348400 W0348500 W0348600 W0348700 W0348800 W0348900 W0349000 W0349100 
W0349200 W0349300 W0349400 W0349500 W0349600 W0349700 W0349800 W0349900 W0350000 
W0350100 W0350200 W0350300 W0350400 W0350500 W0350600 W0350700 W0350800 W0350900 
W0351000 W0351100 W0351200 W0351300 W0351400 W0351500 W0351600 
/*1986 up to week 470*/
W0386400 W0386500 W0386600 W0386700 W0386800 W0386900 W0387000 W0387100 W0387200 
W0387300 W0387400 W0387500 W0387600 W0387700 W0387800 W0387900 W0388000 W0388100 
W0388200 W0388300 W0388400 W0388500 W0388600 W0388700 W0388800 W0388900 W0389000 
W0389100 W0389200 W0389300 W0389400 W0389500 W0389600 W0389700 W0389800 W0389900 
W0390000 W0390100 W0390200 W0390300 W0390400 W0390500 W0390600 W0390700 W0390800 
W0390900 W0391000 W0391100 W0391200 W0391300 W0391400 W0391500 
/*1987 up to week 522*/
W0426300 W0426400 W0426500 W0426600 W0426700 W0426800 W0426900 W0427000 W0427100 
W0427200 W0427300 W0427400 W0427500 W0427600 W0427700 W0427800 W0427900 W0428000 
W0428100 W0428200 W0428300 W0428400 W0428500 W0428600 W0428700 W0428800 W0428900 
W0429000 W0429100 W0429200 W0429300 W0429400 W0429500 W0429600 W0429700 W0429800 
W0429900 W0430000 W0430100 W0430200 W0430300 W0430400 W0430500 W0430600 W0430700 
W0430800 W0430900 W0431000 W0431100 W0431200 W0431300 W0431400 
/*1988 up to week 574*/
W0466700 W0466800 W0466900 W0467000 W0467100 W0467200 W0467300 W0467400 W0467500 
W0467600 W0467700 W0467800 W0467900 W0468000 W0468100 W0468200 W0468300 W0468400 
W0468500 W0468600 W0468700 W0468800 W0468900 W0469000 W0469100 W0469200 W0469300 
W0469400 W0469500 W0469600 W0469700 W0469800 W0469900 W0470000 W0470100 W0470200 
W0470300 W0470400 W0470500 W0470600 W0470700 W0470800 W0470900 W0471000 W0471100 
W0471200 W0471300 W0471400 W0471500 W0471600 W0471700 W0471800 W0471900 
/*1989 up to week 627*/
W0506700 W0506800 W0506900 W0507000 W0507100 W0507200 W0507300 W0507400 W0507500
W0507600 W0507700 W0507800 W0507900 W0508000 W0508100 W0508200 W0508300 W0508400 
W0508500 W0508600 W0508700 W0508800 W0508900 W0509000 W0509100 W0509200 W0509300 
W0509400 W0509500 W0509600 W0509700 W0509800 W0509900 W0510000 W0510100 W0510200 
W0510300 W0510400 W0510500 W0510600 W0510700 W0510800 W0510900 W0511000 W0511100 
W0511200 W0511300 W0511400 W0511500 W0511600 W0511700 W0511800 
/*1990 up to week 679*/
W0546600 W0546700 W0546800 W0546900 W0547000 W0547100 W0547200 W0547300 W0547400 
W0547500 W0547600 W0547700 W0547800 W0547900 W0548000 W0548100 W0548200 W0548300 
W0548400 W0548500 W0548600 W0548700 W0548800 W0548900 W0549000 W0549100 W0549200 
W0549300 W0549400 W0549500 W0549600 W0549700 W0549800 W0549900 W0550000 W0550100 
W0550200 W0550300 W0550400 W0550500 W0550600 W0550700 W0550800 W0550900 W0551000 
W0551100 W0551200 W0551300 W0551400 W0551500 W0551600 W0551700 
/*1991 up to week 731*/
W0586500 W0586600 W0586700 W0586800 W0586900 W0587000 W0587100 W0587200 W0587300 
W0587400 W0587500 W0587600 W0587700 W0587800 W0587900 W0588000 W0588100 W0588200 
W0588300 W0588400 W0588500 W0588600 W0588700 W0588800 W0588900 W0589000 W0589100 
W0589200 W0589300 W0589400 W0589500 W0589600 W0589700 W0589800 W0589900 W0590000 
W0590100 W0590200 W0590300 W0590400 W0590500 W0590600 W0590700 W0590800 W0590900 
W0591000 W0591100 W0591200 W0591300 W0591400 W0591500 W0591600 
/*1992 up to week 783*/
W0626400 W0626500 W0626600 W0626700 W0626800 W0626900 W0627000 W0627100 W0627200 
W0627300 W0627400 W0627500 W0627600 W0627700 W0627800 W0627900 W0628000 W0628100 
W0628200 W0628300 W0628400 W0628500 W0628600 W0628700 W0628800 W0628900 W0629000 
W0629100 W0629200 W0629300 W0629400 W0629500 W0629600 W0629700 W0629800 W0629900 
W0630000 W0630100 W0630200 W0630300 W0630400 W0630500 W0630600 W0630700 W0630800 
W0630900 W0631000 W0631100 W0631200 W0631300 W0631400 W0631500 
/*1993 up to week 835*/
W0666300 W0666400 W0666500 W0666600 W0666700 W0666800 W0666900 W0667000 W0667100
W0667200 W0667300 W0667400 W0667500 W0667600 W0667700 W0667800 W0667900 W0668000 
W0668100 W0668200 W0668300 W0668400 W0668500 W0668600 W0668700 W0668800 W0668900 
W0669000 W0669100 W0669200 W0669300 W0669400 W0669500 W0669600 W0669700 W0669800 
W0669900 W0670000 W0670100 W0670200 W0670300 W0670400 W0670500 W0670600 W0670700 
W0670800 W0670900 W0671000 W0671100 W0671200 W0671300 W0671400 
/*1994 up to week 887*/
W0732700 W0732800 w0732900 W0733000 W0733100 W0733200 W0733300 W0733400 W0733500
W0733600 W0733700 W0733800 W0733900 W0734000 W0734100 W0734200 W0734300 W0734400
W0734500 W0734600 W0734700 W0734800 W0734900 W0735000 W0735100 W0735200 W0735300
W0735400 W0735500 W0735600 W0735700 W0735800 W0735900 W0736000 W0736100 W0736200
W0736300 W0736400 W0736500 W0736600 W0736700 W0736800 W0736900 W0737000 W0737100
W0737200 W0737300 W0737400 W0737500 W0737600 W0737700 W0737800 W0737900 
/*1995 up to week 940*/
W0738000 W0738100 W0738200 W0738300 W0738400 W0738500 W0738600 W0738700 W0738800 
w0738900 W0739000 W0739100 W0739200 W0739300 W0739400 W0739500 W0739600 W0739700 
W0739800 W0739900 W0740000 W0740100 W0740200 W0740300 W0740400 W0740500 W0740600 
W0740700 w0740800 W0740900 w0741000 W0741100 W0741200 W0741300 W0741400 W0741500 
W0741600 W0741700 W0741800 W0741900 W0742000 W0742100 W0742200 W0742300 W0742400 
W0742500 W0742600 w0742700 W0742800 W0742900 W0743000 W0743100 
/*1996 up to week 992*/
W0803900 W0804000 W0804100 W0804200 W0804300 W0804400 W0804500 W0804600 W0804700 
W0804800 W0804900 W0805000 W0805100 w0805200 W0805300 W0805400 W0805500 W0805600 
W0805700 W0805800 W0805900 W0806000 W0806100 W0806200 W0806300 W0806400 W0806500 
w0806600 W0806700 W0806800 W0806900 W0807000 W0807100 W0807200 W0807300 W0807400 
W0807500 W0807600 W0807700 W0807800 W0807900 W0808000 W0808100 W0808200 W0808300 
W0808400 W0808500 W0808600 W0808700 W0808800 W0808900 W0809000 
/*1997 up to week 1044*/
W0809100 W0809200 W0809300 W0809400 W0809500 W0809600 W0809700 W0809800 W0809900 
W0810000 W0810100 W0810200 W0810300 W0810400 W0810500 W0810600 W0810700 W0810800 
W0810900 W0811000 W0811100 W0811200 W0811300 W0811400 W0811500 W0811600 W0811700 
W0811800 W0811900 W0812000 W0812100 W0812200 W0812300 W0812400 W0812500 W0812600 
W0812700 W0812800 W0812900 W0813000 W0813100 W0813200 W0813300 W0813400 W0813500 
W0813600 W0813700 W0813800 W0813900 W0814000 W0814100 W0814200 
/*1998 up to week 1096*/
W0875000 W0875100 W0875200 W0875300 W0875400 W0875500 W0875600 W0875700 W0875800 
W0875900 W0876000 W0876100 W0876200 W0876300 W0876400 W0876500 W0876600 W0876700 
W0876800 W0876900 W0877000 W0877100 W0877200 W0877300 W0877400 W0877500 W0877600 
W0877700 W0877800 W0877900 W0878000 W0878100 W0878200 W0878300 W0878400 W0878500 
W0878600 W0878700 W0878800 W0878900 W0879000 W0879100 W0879200 W0879300 W0879400 
W0879500 W0879600 W0879700 W0879800 W0879900 W0880000 W0880100 
/*1999 up to week 1148*/
W0880200 W0880300 W0880400 W0880500 W0880600 W0880700 W0880800 W0880900 W0881000 
W0881100 W0881200 W0881300 W0881400 W0881500 W0881600 W0881700 W0881800 W0881900 
w0882000 W0882100 W0882200 W0882300 W0882400 W0882500 W0882600 W0882700 W0882800 
W0882900 W0883000 W0883100 W0883200 W0883300 W0883400 W0883500 W0883600 W0883700 
W0883800 W0883900 W0884000 W0884100 w0884200 W0884300 W0884400 W0884500 W0884600 
W0884700 W0884800 W0884900 W0885000 W0885100 W0885200 W0885300 
/*2000 up to week 1200*/
W0932100 W0932200 W0932300 W0932400 W0932500 W0932600 W0932700 W0932800 W0932900 
W0933000 W0933100 W0933200 W0933300 W0933400 W0933500 W0933600 W0933700 W0933800 
W0933900 W0934000 W0934100 W0934200 W0934300 W0934400 W0934500 W0934600 W0934700 
W0934800 W0934900 W0935000 W0935100 W0935200 W0935300 W0935400 W0935500 W0935600 
W0935700 W0935800 W0935900 W0936000 W0936100 W0936200 W0936300 W0936400 W0936500 
W0936600 W0936700 W0936800 W0936900 W0937000 W0937100 W0937200 
/*2001 up to week 1252*/
W0937300 W0937400 W0937500 W0937600 W0937700 W0937800 W0937900 W0938000 W0938100 
W0938200 W0938300 W0938400 W0938500 W0938600 W0938700 W0938800 W0938900 W0939000 
W0939100 W0939200 W0939300 W0939400 W0939500 W0939600 W0939700 W0939800 W0939900 
W0940000 W0940100 W0940200 W0940300 W0940400 W0940500 W0940600 W0940700 W0940800 
W0940900 W0941000 W0941100 W0941200 W0941300 W0941400 W0941500 W0941600 W0941700 
W0941800 W0941900 W0942000 W0942100 W0942200 W0942300 W0942400 
/*2002 up to week 1304*/
W0997600 W0997700 W0997800 W0997900 W0998000 W0998100 W0998200 W0998300 W0998400 
W0998500 W0998600 W0998700 W0998800 W0998900 W0999000 W0999100 W0999200 W0999300 
W0999400 W0999500 W0999600 W0999700 W0999800 W0999900 W1000000 W1000100 W1000200 
W1000300 W1000400 W1000500 W1000600 W1000700 W1000800 W1000900 W1001000 W1001100 
W1001200 W1001300 W1001400 W1001500 W1001600 W1001700 W1001800 W1001900 W1002000 
W1002100 W1002200 W1002300 W1002400 W1002500 W1002600 W1002700 
/*2003 up to week 1356*/
W1002800 W1002900 W1003000 W1003100 W1003200 W1003300 W1003400 W1003500 W1003600 
W1003700 W1003800 W1003900 W1004000 W1004100 W1004200 W1004300 W1004400 W1004500 
W1004600 W1004700 W1004800 W1004900 W1005000 W1005100 W1005200 W1005300 W1005400 
W1005500 W1005600 W1005700 W1005800 W1005900 W1006000 W1006100 W1006200 W1006300 
W1006400 W1006500 W1006600 W1006700 W1006800 W1006900 W1007000 W1007100 W1007200 
W1007300 W1007400 W1007500 W1007600 W1007700 W1007800 W1007900 W1008000 
/*2004 up to week 1409*/
W1008100 W1008200 W1008300 W1008400 W1008500 W1008600 W1008700 W1008800 W1008900 
W1009000 W1009100 W1009200 W1009300 W1009400 W1009500 W1009600 W1009700 W1059600 
W1059700 W1059800 W1059900 W1060000 W1060100 W1060200 W1060300 W1060400 W1060500 
W1060600 W1060700 W1060800 W1060900 W1061000 W1061100 W1061200 W1061300 W1061400 
W1061500 W1061600 W1061700 W1061800 W1061900 W1062000 W1062100 W1062200 W1062300 
W1062400 W1062500 W1062600 W1062700 W1062800 W1062900 W1063000 
/*2005 up to week 1461*/
W1063100 W1063200 W1063300 W1063400 W1063500 w1063600 W1063700 W1063800 W1063900 
W1064000 W1064100 W1064200 W1064300 W1064400 W1064500 W1064600 W1064700 W1064800 
W1064900 W1065000 W1065100 W1065200 W1065300 W1065400 W1065500 W1065600 W1065700 
W1065800 W1065900 W1066000 W1066100 W1066200 W1066300 W1066400 W1066500 W1066600 
W1066700 W1066800 W1066900 W1067000 W1067100 W1067200 W1067300 W1067400 W1067500 
W1067600 W1067700 W1067800 W1067900 W1068000 W1068100 W1068200 W1068300
/*2006 up to week 1514*/
W1068400 W1068500 W1068600 W1068700 W1068800 W1068900 W1069000 W1069100 W1069200
W1069300 W1069400 W1069500 W1069600 W1069700 W1069800 W1069900 W1116000 W1116100
W1116200 W1116300 W1116400 W1116500 W1116600 W1116700 W1116800 W1116900 W1117000
W1117100 W1117200 W1117300 W1117400 W1117500 W1117600 W1117700 W1117800 W1117900
W1118000 W1118100 W1118200 W1118300 W1118400 W1118500 W1118600 W1118700 W1118800
W1118900 W1119000 W1119100 W1119200 W1119300 W1119400 W1119500 
/*2007 up to WEEK 1566 (52)*/
W1119600 W1119700 W1119800 W1119900 W1120000 W1120100 W1120200 W1120300 W1120400 
W1120500 W1120600 W1120700 W1120800 W1120900 W1121000 W1121100 W1121200 W1121300
W1121400 W1121500 W1121600 W1121700 W1121800 W1121900 W1122000 W1122100 W1122200
W1122300 W1122400 W1122500 W1122600 W1122700 W1122800 W1122900 W1123000 W1123100
W1123200 W1123300 W1123400 W1123500 W1123600 W1123700 W1123800 W1123900 W1124000
W1124100 W1124200 W1124300 W1124400 W1124500 W1124600 W1124700;
/*2008 up to week 1618 (52)*/

**now do hours;
array h(1618) 
W0002100 W0002200 W0002300 W0002400 W0002500 W0002600 W0002700 W0002800 W0002900
W0003000 W0003100 W0003200 W0003300 W0003400 W0003500 W0003600 W0003700 W0003800
W0003900 W0004000 W0004100 W0004200 W0004300 W0004400 W0004500 W0004600 W0004700
W0004800 W0004900 W0005000 W0005100 W0005200 W0005300 W0005400 W0005500 W0005600
W0005700 W0005800 W0005900 W0006000 W0006100 W0006200 W0006300 W0006400 W0006500
W0006600 W0006700 W0006800 W0006900 W0007000 W0007100 W0007200 W0007300
/*1978 to week 53*/
W0007400 W0007500 W0007600 W0007700 W0007800 W0007900 W0008000 W0008100 W0008200
W0008300 W0008400 W0008500 W0008600 W0008700 W0008800 W0008900 W0009000 W0009100
W0009200 W0009300 W0009400 W0009500 W0009600 W0009700 W0009800 W0009900 W0010000
W0010100 W0010200 W0010300 W0010400 W0010500 W0010600 W0010700 W0010800 W0010900
W0011000 W0011100 W0011200 W0011300 W0011400 W0011500 W0011600 W0011700 W0011800
W0011900 W0012000 W0012100 W0012200 W0012300 W0012400 W0012500
/*1979 to week 105*/
W0074400 W0074500 W0074600 W0074700 W0074800 W0074900 W0075000 W0075100 W0075200
W0075300 W0075400 W0075500 W0075600 W0075700 W0075800 W0075900 W0076000 W0076100
W0076200 W0076300 W0076400 W0076500 W0076600 W0076700 W0076800 W0076900 W0077000
W0077100 W0077200 W0077300 W0077400 W0077500 W0077600 W0077700 W0077800 W0077900
W0078000 W0078100 W0078200 W0078300 W0078400 W0078500 W0078600 W0078700 W0078800
W0078900 W0079000 W0079100 W0079200 W0079300 W0079400 W0079500
/*1980 to week 157*/
W0114300 W0114400 W0114500 W0114600 W0114700 W0114800 W0114900 W0115000 W0115100
W0115200 W0115300 W0115400 W0115500 W0115600 W0115700 W0115800 W0115900 W0116000
W0116100 W0116200 W0116300 W0116400 W0116500 W0116600 W0116700 W0116800 W0116900
W0117000 W0117100 W0117200 W0117300 W0117400 W0117500 W0117600 W0117700 W0117800
W0117900 W0118000 W0118100 W0118200 W0118300 W0118400 W0118500 W0118600 W0118700
W0118800 W0118900 W0119000 W0119100 W0119200 W0119300 W0119400 
/*1981 to week 209*/
W0154200 W0154300 W0154400 W0154500 W0154600 W0154700 W0154800 W0154900 W0155000
W0155100 W0155200 W0155300 W0155400 W0155500 W0155600 W0155700 W0155800 W0155900
W0156000 W0156100 W0156200 W0156300 W0156400 W0156500 W0156600 W0156700 W0156800
W0156900 W0157000 W0157100 W0157200 W0157300 W0157400 W0157500 W0157600 W0157700
W0157800 W0157900 W0158000 W0158100 W0158200 W0158300 W0158400 W0158500 W0158600
W0158700 W0158800 W0158900 W0159000 W0159100 W0159200 W0159300
/*1982 to week 261*/
w0194100 W0194200 W0194300 W0194400 W0194500 W0194600 W0194700 W0194800 W0194900
W0195000 W0195100 W0195200 W0195300 W0195400 W0195500 W0195600 W0195700 W0195800
W0195900 W0196000 W0196100 W0196200 W0196300 W0196400 W0196500 W0196600 W0196700
W0196800 W0196900 W0197000 W0197100 W0197200 W0197300 W0197400 W0197500 W0197600
W0197700 W0197800 W0197900 W0198000 W0198100 W0198200 W0198300 W0198400 W0198500
W0198600 W0198700 W0198800 W0198900 W0199000 W0199100 W0199200 
/*1983 up to week 313*/
W0234000 W0234100 W0234200 W0234300 W0234400 W0234500 W0234600 W0234700 W0234800
W0234900 W0235000 W0235100 W0235200 W0235300 W0235400 W0235500 W0235600 W0235700
W0235800 W0235900 W0236000 W0236100 W0236200 W0236300 W0236400 W0236500 W0236600
W0236700 W0236800 W0236900 W0237000 W0237100 W0237200 W0237300 W0237400 W0237500
W0237600 W0237700 W0237800 W0237900 W0238000 W0238100 W0238200 W0238300 W0238400
W0238500 W0238600 W0238700 W0238800 W0238900 W0239000 W0239100 W0239200
/*1984 up to week 366*/
W0274500 W0274600 W0274700 W0274800 W0274900 W0275000 W0275100 W0275200 W0275300
W0275400 W0275500 W0275600 W0275700 W0275800 W0275900 W0276000 W0276100 W0276200
W0276300 W0276400 W0276500 W0276600 W0276700 W0276800 W0276900 W0277000 W0277100
W0277200 W0277300 W0277400 W0277500 W0277600 W0277700 W0277800 W0277900 W0278000
W0278100 W0278200 W0278300 W0278400 W0278500 W0278600 W0278700 W0278800 W0278900
W0279000 W0279100 W0279200 W0279300 W0279400 W0279500 W0279600
/*1985 to week 418*/
W0314400 W0314500 W0314600 W0314700 W0314800 W0314900 W0315000 W0315100 W0315200
W0315300 W0315400 W0315500 W0315600 W0315700 W0315800 W0315900 W0316000 W0316100
W0316200 W0316300 W0316400 W0316500 W0316600 W0316700 W0316800 W0316900 W0317000
W0317100 W0317200 W0317300 W0317400 W0317500 W0317600 W0317700 W0317800 W0317900
W0318000 W0318100 W0318200 W0318300 W0318400 W0318500 W0318600 W0318700 W0318800
W0318900 W0319000 W0319100 W0319200 W0319300 W0319400 W0319500
/*1986 to week 470*/
W0354300 W0354400 W0354500 W0354600 W0354700 W0354800 W0354900 W0355000 W0355100
W0355200 W0355300 W0355400 W0355500 W0355600 W0355700 W0355800 W0355900 W0356000
W0356100 W0356200 W0356300 W0356400 W0356500 W0356600 W0356700 W0356800 W0356900
W0357000 W0357100 W0357200 W0357300 W0357400 W0357500 W0357600 W0357700 W0357800
W0357900 W0358000 W0358100 W0358200 W0358300 W0358400 W0358500 W0358600 W0358700
W0358800 W0358900 W0359000 W0359100 W0359200 W0359300 W0359400
/*1987 to week 522*/
W0394200 W0394300 W0394400 W0394500 W0394600 W0394700 W0394800 W0394900 W0395000
W0395100 W0395200 W0395300 W0395400 W0395500 W0395600 W0395700 W0395800 W0395900
W0396000 W0396100 W0396200 W0396300 W0396400 W0396500 W0396600 W0396700 W0396800
W0396900 W0397000 W0397100 W0397200 W0397300 W0397400 W0397500 W0397600 W0397700
W0397800 W0397900 W0398000 W0398100 W0398200 W0398300 W0398400 W0398500 W0398600
W0398700 W0398800 W0398900 W0399000 W0399100 W0399200 W0399300
/*1988 to week 574*/
W0434100 W0434200 W0434300 W0434400 W0434500 W0434600 W0434700 W0434800 W0434900
W0435000 W0435100 W0435200 W0435300 W0435400 W0435500 W0435600 W0435700 W0435800
W0435900 W0436000 W0436100 W0436200 W0436300 W0436400 W0436500 W0436600 W0436700
W0436800 W0436900 W0437000 W0437100 W0437200 W0437300 W0437400 W0437500 W0437600
W0437700 W0437800 W0437900 W0438000 W0438100 W0438200 W0438300 W0438400 W0438500
W0438600 W0438700 W0438800 W0438900 W0439000 W0439100 W0439200 W0439300
/*1989 to week 627*/
W0474600 W0474700 W0474800 W0474900 W0475000 W0475100 W0475200 W0475300 W0475400
W0475500 W0475600 W0475700 W0475800 W0475900 W0476000 W0476100 W0476200 W0476300
W0476400 W0476500 W0476600 W0476700 W0476800 W0476900 W0477000 W0477100 W0477200
W0477300 W0477400 W0477500 W0477600 W0477700 W0477800 W0477900 W0478000 W0478100
W0478200 W0478300 W0478400 W0478500 W0478600 W0478700 W0478800 W0478900 W0479000
W0479100 W0479200 W0479300 W0479400 W0479500 W0479600 W0479700
/*1990 to week 679*/
W0514500 W0514600 W0514700 W0514800 W0514900 W0515000 W0515100 W0515200 W0515300
W0515400 W0515500 W0515600 W0515700 W0515800 W0515900 W0516000 W0516100 W0516200
W0516300 W0516400 W0516500 W0516600 W0516700 W0516800 W0516900 W0517000 W0517100
W0517200 W0517300 W0517400 W0517500 W0517600 W0517700 W0517800 W0517900 W0518000
W0518100 W0518200 W0518300 W0518400 W0518500 W0518600 W0518700 W0518800 W0518900
W0519000 W0519100 W0519200 W0519300 W0519400 W0519500 W0519600
/*1991 to week 731*/
W0554400 W0554500 W0554600 W0554700 W0554800 W0554900 W0555000 W0555100 W0555200
W0555300 W0555400 W0555500 W0555600 W0555700 W0555800 W0555900 W0556000 W0556100
W0556200 W0556300 W0556400 W0556500 W0556600 W0556700 W0556800 W0556900 W0557000
W0557100 W0557200 W0557300 W0557400 W0557500 W0557600 W0557700 W0557800 W0557900
W0558000 W0558100 W0558200 W0558300 W0558400 W0558500 W0558600 W0558700 W0558800
W0558900 W0559000 W0559100 W0559200 W0559300 W0559400 W0559500
/*1992 to week 783*/
W0594300 W0594400 W0594500 W0594600 W0594700 W0594800 W0594900 W0595000 W0595100
W0595200 W0595300 W0595400 W0595500 W0595600 W0595700 W0595800 W0595900 W0596000
W0596100 W0596200 W0596300 W0596400 W0596500 W0596600 W0596700 W0596800 W0596900
W0597000 W0597100 W0597200 W0597300 W0597400 W0597500 W0597600 W0597700 W0597800
W0597900 W0598000 W0598100 W0598200 W0598300 W0598400 W0598500 W0598600 W0598700
W0598800 W0598900 W0599000 W0599100 W0599200 W0599300 W0599400
/*1993 to week 835*/
W0634200 W0634300 W0634400 W0634500 W0634600 W0634700 W0634800 W0634900 W0635000
W0635100 W0635200 W0635300 W0635400 W0635500 W0635600 W0635700 W0635800 W0635900
W0636000 W0636100 W0636200 W0636300 W0636400 W0636500 W0636600 W0636700 W0636800
W0636900 W0637000 W0637100 W0637200 W0637300 W0637400 W0637500 W0637600 W0637700
W0637800 W0637900 W0638000 W0638100 W0638200 W0638300 W0638400 W0638500 W0638600
W0638700 W0638800 W0638900 W0639000 W0639100 W0639200 W0639300
/*1994 to week 887*/
W0674100 W0674200 W0674300 W0674400 W0674500 W0674600 W0674700 W0674800 W0674900
W0675000 W0675100 W0675200 W0675300 W0675400 W0675500 W0675600 W0675700 W0675800
W0675900 W0676000 W0676100 W0676200 W0676300 W0676400 W0676500 W0676600 W0676700
W0676800 W0676900 W0677000 W0677100 W0677200 W0677300 W0677400 W0677500 W0677600
W0677700 W0677800 W0677900 W0678000 W0678100 W0678200 W0678300 W0678400 W0678500
W0678600 W0678700 W0678800 W0678900 W0679000 W0679100 W0679200 W0679300
/*1995 to week 940*/
W0679400 W0679500 W0679600 W0679700 W0679800 W0679900 W0680000 W0680100 W0680200
W0680300 W0680400 W0680500 W0680600 W0680700 W0680800 W0680900 W0681000 W0681100
W0681200 W0681300 W0681400 W0681500 W0681600 W0681700 W0681800 W0681900 W0682000
W0682100 W0682200 W0682300 W0682400 W0682500 W0682600 W0682700 W0682800 W0682900
W0683000 W0683100 W0683200 W0683300 W0683400 W0683500 W0683600 W0683700 W0683800
W0683900 W0684000 W0684100 W0684200 W0684300 W0684400 W0684500
/*1996 to week 992*/
W0745800 W0745900 W0746000 W0746100 W0746200 W0746300 W0746400 W0746500 W0746600
W0746700 W0746800 W0746900 W0747000 W0747100 W0747200 W0747300 W0747400 W0747500
W0747600 W0747700 W0747800 W0747900 W0748000 W0748100 W0748200 W0748300 W0748400
W0748500 W0748600 W0748700 W0748800 W0748900 W0749000 W0749100 W0749200 W0749300
W0749400 W0749500 W0749600 W0749700 W0749800 W0749900 W0750000 W0750100 w0750200
W0750300 W0750400 W0750500 W0750600 W0750700 W0750800 W0750900
/*1997 to week 1044*/
W0751000 W0751100 W0751200 W0751300 W0751400 W0751500 W0751600 W0751700 W0751800
W0751900 W0752000 W0752100 W0752200 W0752300 W0752400 W0752500 W0752600 W0752700
W0752800 W0752900 W0753000 W0753100 W0753200 W0753300 W0753400 W0753500 W0753600
W0753700 W0753800 W0753900 W0754000 W0754100 W0754200 W0754300 W0754400 W0754500
W0754600 W0754700 W0754800 W0754900 W0755000 W0755100 W0755200 W0755300 W0755400
W0755500 W0755600 W0755700 W0755800 W0755900 W0756000 W0756100
/*1998 to week 1096*/
W0816900 W0817000 W0817100 W0817200 W0817300 W0817400 W0817500 W0817600 W0817700
W0817800 W0817900 W0818000 W0818100 W0818200 W0818300 W0818400 W0818500 W0818600
W0818700 W0818800 W0818900 W0819000 W0819100 W0819200 W0819300 W0819400 W0819500
W0819600 W0819700 W0819800 W0819900 W0820000 W0820100 W0820200 W0820300 W0820400
W0820500 W0820600 W0820700 W0820800 W0820900 W0821000 W0821100 W0821200 W0821300
W0821400 W0821500 W0821600 W0821700 W0821800 W0821900 W0822000
/*1999 to week 1148*/
W0822100 W0822200 W0822300 W0822400 W0822500 W0822600 W0822700 W0822800 W0822900
W0823000 W0823100 W0823200 W0823300 W0823400 W0823500 W0823600 W0823700 W0823800
W0823900 W0824000 W0824100 W0824200 W0824300 W0824400 W0824500 W0824600 W0824700
W0824800 W0824900 W0825000 W0825100 W0825200 W0825300 W0825400 W0825500 W0825600
W0825700 W0825800 W0825900 W0826000 W0826100 W0826200 W0826300 W0826400 W0826500
W0826600 W0826700 W0826800 W0826900 W0827000 W0827100 W0827200
/*2000 to week 1200*/
W0888100 W0888200 W0888300 W0888400 W0888500 W0888600 W0888700 W0888800 W0888900
W0889000 W0889100 W0889200 W0889300 W0889400 W0889500 W0889600 W0889700 W0889800
W0889900 W0890000 W0890100 W0890200 W0890300 W0890400 W0890500 W0890600 W0890700
W0890800 W0890900 W0891000 W0891100 W0891200 W0891300 W0891400 W0891500 W0891600
W0891700 W0891800 W0891900 W0892000 W0892100 W0892200 W0892300 W0892400 W0892500
W0892600 W0892700 W0892800 W0892900 W0893000 W0893100 W0893200
/*2001 to week 1252*/
W0893300 W0893400 W0893500 W0893600 W0893700 W0893800 W0893900 W0894000 W0894100
W0894200 W0894300 W0894400 W0894500 W0894600 W0894700 W0894800 W0894900 W0895000
W0895100 W0895200 W0895300 W0895400 W0895500 W0895600 W0895700 W0895800 W0895900
W0896000 W0896100 W0896200 W0896300 W0896400 W0896500 W0896600 W0896700 W0896800
W0896900 W0897000 W0897100 W0897200 W0897300 W0897400 W0897500 W0897600 W0897700
W0897800 W0897900 W0898000 W0898100 W0898200 W0898300 W0898400
/*2002 to week 1304*/
W0948600 W0948700 W0948800 W0948900 W0949000 W0949100 W0949200 W0949300 W0949400
W0949500 W0949600 W0949700 W0949800 W0949900 W0950000 W0950100 W0950200 W0950300
W0950400 W0950500 W0950600 W0950700 W0950800 W0950900 W0951000 W0951100 W0951200
W0951300 W0951400 W0951500 W0951600 W0951700 W0951800 W0951900 W0952000 W0952100
W0952200 W0952300 W0952400 W0952500 W0952600 W0952700 W0952800 W0952900 W0953000
W0953100 W0953200 W0953300 W0953400 W0953500 W0953600 W0953700
/*2003 to week 1356*/
W0953800 W0953900 W0954000 W0954100 W0954200 W0954300 W0954400 W0954500 W0954600
W0954700 W0954800 W0954900 W0955000 W0955100 W0955200 W0955300 W0955400 W0955500
W0955600 W0955700 W0955800 W0955900 W0956000 W0956100 W0956200 W0956300 W0956400
W0956500 W0956600 W0956700 W0956800 W0956900 W0957000 W0957100 W0957200 W0957300
W0957400 W0957500 W0957600 W0957700 W0957800 W0957900 W0958000 W0958100 W0958200
W0958300 W0958400 W0958500 W0958600 W0958700 W0958800 W0958900 W0959000
/*2004 to week 1409*/
W0959100 W0959200 W0959300 W0959400 W0959500 W0959600 W0959700 W0959800 W0959900
W0960000 W0960100 W0960200 W0960300 W0960400 W0960500 W0960600 W0960700 W1016700
W1016800 W1016900 W1017000 W1017100 W1017200 W1017300 W1017400 W1017500 W1017600
W1017700 W1017800 W1017900 W1018000 W1018100 W1018200 W1018300 W1018400 W1018500
W1018600 W1018700 W1018800 W1018900 W1019000 W1019100 W1019200 W1019300 W1019400
W1019500 W1019600 W1019700 W1019800 W1019900 W1020000 W1020100
/* 2005 to week 1461*/
W1020200 W1020300 W1020400 W1020500 W1020600 W1020700 W1020800 W1020900 W1021000
W1021100 W1021200 W1021300 W1021400 W1021500 W1021600 W1021700 W1021800 W1021900
W1022000 W1022100 W1022200 W1022300 W1022400 W1022500 W1022600 W1022700 W1022800
W1022900 W1023000 W1023100 W1023200 W1023300 W1023400 W1023500 W1023600 W1023700
W1023800 W1023900 W1024000 W1024100 W1024200 W1024300 W1024400 W1024500 W1024600
W1024700 W1024800 W1024900 W1025000 W1025100 W1025200 W1025300 W1025400
/*2006 to week 1514*/
W1025500 W1025600 W1025700 W1025800 W1025900 W1026000 W1026100 W1026200 W1026300
W1026400 W1026500 W1026600 W1026700 W1026800 W1026900 W1027000 W1076700 W1076800
W1076900 W1077000 W1077100 W1077200 W1077300 W1077400 W1077500 W1077600 W1077700
W1077800 W1077900 W1078000 W1078100 W1078200 W1078300 W1078400 W1078500 W1078600
W1078700 W1078800 W1078900 W1079000 W1079100 W1079200 W1079300 W1079400 W1079500
W1079600 W1079700 W1079800 W1079900 W1080000 W1080100 W1080200
/*2007 to week 1566*/
W1080300 W1080400 W1080500 W1080600 W1080700 W1080800 W1080900 W1081000 W1081100
W1081200 W1081300 W1081400 W1081500 W1081600 W1081700 W1081800 W1081900 W1082000
W1082100 W1082200 W1082300 W1082400 W1082500 W1082600 W1082700 W1082800 W1082900
W1083000 W1083100 W1083200 W1083300 W1083400 W1083500 W1083600 W1083700 W1083800
W1083900 W1084000 W1084100 W1084200 W1084300 W1084400 W1084500 W1084600 W1084700
W1084800 W1084900 W1085000 W1085100 W1085200 W1085300 W1085400
/*2008 to week 1618*/;


**note, I am going to topcode the hours variable to 60, which still seems high;
do k = 1 to 1618;
if h(k) gt 60 then h(k) = 60;
end;

*first twelve weeks;
b1 = weekbir;
b12 = weekbir + 11;
*second twelve weeks (+2);
b13 = b12 + 1;
b26 = b13+ 13;
*first six months;
*second six months;
b27 = b26 + 1;
**first year;
b52 = b1 + 51;
**year two;
b53 = b52 + 1;
b104 = b53 + 51;
**year three;
b105 = b104 + 1;
b157 = b105 + 51;
**year four;
b158 = b157 + 1;
b210 = b158 + 51;

*12 months prior to birth;
bef12 = b1 - 52;
if bef12 le 0 then bef12 = .;
b0 = b1 - 1;
if b0 le 0 then b0 = .;

*note, can't go past end of array;
if b1 gt 1618 then b1 = .;
if b12 gt 1618 then b12 = .;
if b13 gt 1618 then b13 = .;
if b26 gt 1618 then b26 = .;
if b27 gt 1618 then b27 = .;
if b52 gt 1618 then b52 = .;
if b53 gt 1618 then b53 = .;
if b104 gt 1618 then b104 = .;
if b105 gt 1618 then b105 = .;
if b157 gt 1618 then b157 = .;
if b158 gt 1618 then b158 = .;
if b210 gt 1618 then b210 = .;
if bef12 gt 1618 then bef12 = .;
if b0 gt 1618 then b0 = .;


*m is number of weeks worked;
*a is active military;
*h is hours;

if (bef12 ne . and b0 ne .) then do;
*work;
mbf = 0;
*hours of work;
mbfh = 0;
**missing hours, negative three;
mbfhn3 = 0;
*no info;
mbf0 = 0;
*missing info;
mbf3 = 0;
*military;
mbf7 = 0;
end;
*weeks worked prior 12 months;
if (bef12 ne . and b0 ne .) then do;
do k = bef12 to b0;
if s(k) = 0 then mbf0 = mbf0 + 1;
if s(k) = 3 then mbf3 = mbf3 + 1;
if s(k) = 7 then mbf7 = mbf7 + 1;
if s(k) ge 100 then mbf = mbf + 1;
*now hours;
If (s(k) ge 100 and h(k) ge 0) then mbfh = mbfh + h(k);
If (s(k) ge 100 and h(k) = -3) then mbfhn3 = mbfhn3 + 1;
**missing hours, negative three;
end;
end;

**now weeks 1 to 12, first quarter after birth;
if (b1 ne . and b12 ne .) then do;
*work;
mb12 = 0;
*hours of work;
mb12h = 0;
**missing hours, negative three;
mb12hn3 = 0;
*no info;
mb120 = 0;
*missing info;
mb123 = 0;
*military;
mb127 = 0;
end;
if (b1 ne . and b12 ne .) then do;
do k = b1 to b12;
if s(k) = 0 then mb120 = mb120 + 1;
if s(k) = 3 then mb123 = mb123 + 1;
if s(k) = 7 then mb127 = mb127 + 1;
if s(k) ge 100 then mb12 = mb12 + 1;
*now hours;
If (s(k) ge 100 and h(k) ge 0) then mb12h = mb12h + h(k);
If (s(k) ge 100 and h(k) = -3) then mb12hn3 = mb12hn3 + 1;
**missing hours, negative three;
end;
end;

**now weeks 13 to 26, second quarter after birth;
if (b13 ne . and b26 ne .) then do;
*work;
mb13 = 0;
*hours of work;
mb13h = 0;
**missing hours, negative three;
mb13hn3 = 0;
*no info;
mb130 = 0;
*missing info;
mb133 = 0;
*military;
mb137 = 0;
end;
if (b13 ne . and b26 ne .) then do;
do k = b13 to b26;
if s(k) = 0 then mb130 = mb130 + 1;
if s(k) = 3 then mb133 = mb133 + 1;
if s(k) = 7 then mb137 = mb137 + 1;
if s(k) ge 100 then mb13 = mb13 + 1;
*now hours;
If (s(k) ge 100 and h(k) ge 0) then mb13h = mb13h + h(k);
If (s(k) ge 100 and h(k) = -3) then mb13hn3 = mb13hn3 + 1;
**missing hours, negative three;
end;
end;

**now week 1 to 26, first six months after birth;
if (b1 ne . and b26 ne .) then do;
*work;
mb26 = 0;
*hours of work;
mb26h = 0;
**missing hours, negative three;
mb26hn3 = 0;
*no info;
mb260 = 0;
*missing info;
mb263 = 0;
*military;
mb267 = 0;
end;
if (b1 ne . and b26 ne .) then do;
do k = b1 to b26;
if s(k) = 0 then mb260 = mb260 + 1;
if s(k) = 3 then mb263 = mb263 + 1;
if s(k) = 7 then mb267 = mb267 + 1;
if s(k) ge 100 then mb26 = mb26 + 1;
*now hours;
If (s(k) ge 100 and h(k) ge 0) then mb26h = mb26h + h(k);
If (s(k) ge 100 and h(k) = -3) then mb26hn3 = mb26hn3 + 1;
**missing hours, negative three;
end;
end;

**now week 27 to 52, second six months after birth;
if (b27 ne . and b52 ne .) then do;
*work;
mb52 = 0;
*hours of work;
mb52h = 0;
**missing hours, negative three;
mb52hn3 = 0;
*no info;
mb520 = 0;
*missing info;
mb523 = 0;
*military;
mb527 = 0;
end;
if (b27 ne . and b52 ne .) then do;
do k = b27 to b52;
if s(k) = 0 then mb520 = mb520 + 1;
if s(k) = 3 then mb523 = mb523 + 1;
if s(k) = 7 then mb527 = mb527 + 1;
if s(k) ge 100 then mb52 = mb52 + 1;
*now hours;
If (s(k) ge 100 and h(k) ge 0) then mb52h = mb52h + h(k);
If (s(k) ge 100 and h(k) = -3) then mb52hn3 = mb52hn3 + 1;
**missing hours, negative three;
end;
end;

**now full year 1;
if (b1 ne . and b52 ne .) then do;
*work;
mby1 = 0;
*hours of work;
mby1h = 0;
**missing hours, negative three;
mby1hn3 = 0;
*no info;
mby10 = 0;
*missing info;
mby13 = 0;
*military;
mby17 = 0;
end;
if (b1 ne . and b52 ne .) then do;
do k = b1 to b52;
if s(k) = 0 then mby10 = mby10 + 1;
if s(k) = 3 then mby13 = mby13 + 1;
if s(k) = 7 then mby17 = mby17 + 1;
if s(k) ge 100 then mby1 = mby1 + 1;
*now hours;
If (s(k) ge 100 and h(k) ge 0) then mby1h = mby1h + h(k);
If (s(k) ge 100 and h(k) = -3) then mby1hn3 = mby1hn3 + 1;
**missing hours, negative three;
end;
end;

**now full year 2;
if (b53 ne . and b104 ne .) then do;
*work;
mby2 = 0;
*hours of work;
mby2h = 0;
**missing hours, negative three;
mby2hn3 = 0;
*no info;
mby20 = 0;
*missing info;
mby23 = 0;
*military;
mby27 = 0;
end;
if (b53 ne . and b104 ne .) then do;
do k = b53 to b104;
if s(k) = 0 then mby20 = mby20 + 1;
if s(k) = 3 then mby23 = mby23 + 1;
if s(k) = 7 then mby27 = mby27 + 1;
if s(k) ge 100 then mby2 = mby2 + 1;
*now hours;
If (s(k) ge 100 and h(k) ge 0) then mby2h = mby2h + h(k);
If (s(k) ge 100 and h(k) = -3) then mby2hn3 = mby2hn3 + 1;
**missing hours, negative three;
end;
end;

**now full year 3;
if (b105 ne . and b157 ne .) then do;
*work;
mby3 = 0;
*hours of work;
mby3h = 0;
**missing hours, negative three;
mby3hn3 = 0;
*no info;
mby30 = 0;
*missing info;
mby33 = 0;
*military;
mby37 = 0;
end;
if (b105 ne . and b157 ne .) then do;
do k = b105 to b157;
if s(k) = 0 then mby30 = mby30 + 1;
if s(k) = 3 then mby33 = mby33 + 1;
if s(k) = 7 then mby37 = mby37 + 1;
if s(k) ge 100 then mby3 = mby3 + 1;
*now hours;
If (s(k) ge 100 and h(k) ge 0) then mby3h = mby3h + h(k);
If (s(k) ge 100 and h(k) = -3) then mby3hn3 = mby3hn3 + 1;
**missing hours, negative three;
end;
end;

**now full year 4;
if (b158 ne . and b210 ne .) then do;
*work;
mby4 = 0;
*hours of work;
mby4h = 0;
**missing hours, negative three;
mby4hn3 = 0;
*no info;
mby40 = 0;
*missing info;
mby43 = 0;
*military;
mby47 = 0;
end;
if (b158 ne . and b210 ne .) then do;
do k = b158 to b210;
if s(k) = 0 then mby40 = mby40 + 1;
if s(k) = 3 then mby43 = mby43 + 1;
if s(k) = 7 then mby47 = mby47 + 1;
if s(k) ge 100 then mby4 = mby4 + 1;
*now hours;
If (s(k) ge 100 and h(k) ge 0) then mby4h = mby4h + h(k);
If (s(k) ge 100 and h(k) = -3) then mby4hn3 = mby4hn3 + 1;
**missing hours, negative three;
end;
end;

**okay, start calculating;
*now year one;
**weeks worked in year 1;
wksy1 = mby1 + mby17;
*number of weeks with missing info., in year 1;
wksy103 = mby10 + mby13;
**number of hours worked in year 1;
**note, for military, I'm treating as though 40 hours/week;
hrsy1 = mby1h + 40*mby17;
*number of weeks with missing info., in year 1;
hrsy1n3 = mby1hn3;

*now year two;
**weeks worked in year 2;
wksy2 = mby2 + mby27;
*number of weeks with missing info., in year 2;
wksy203 = mby20 + mby23;
**number of hours worked in year 2;
**note, for military, I'm treating as though 40 hours/week;
hrsy2 = mby2h + 40*mby27;
*number of weeks with missing info., in year 2;
hrsy2n3 = mby2hn3;

*now year three;
**weeks worked in year 3;
wksy3 = mby3 + mby37;
*number of weeks with missing info., in year 3;
wksy303 = mby30 + mby33;
**number of hours worked in year 3;
**note, for military, I'm treating as though 40 hours/week;
hrsy3 = mby3h + 40*mby37;
*number of weeks with missing info., in year 3;
hrsy3n3 = mby3hn3;

**weeks worked in year 4;
wksy4 = mby4 + mby47;
*number of weeks with missing info., in year 4;
wksy403 = mby40 + mby43;
**number of hours worked in year 4;
**note, for military, I'm treating as though 40 hours/week;
hrsy4 = mby4h + 40*mby47;
*number of weeks with missing info., in year 4;
hrsy4n3 = mby4hn3;

**now prior 12 months;
**weeks worked prior 12 months;
wksp = mbf + mbf7;
*number of weeks with missing info.;
wksp03 = mbf0 + mbf3;
**number of hours worked;
**note, for military, I'm treating as though 40 hours/week;
hrsp = mbfh + 40*mbf7;
*number of weeks with missing info.;
hrspn3 = mbfhn3;

**now first quarter after birth;
**weeks worked first quarter after birth;
wks12 = mb12 + mb127;
*number of weeks with missing info.;
wks1203 = mb120 + mb123;
**number of hours worked;
**note, for military, I'm treating as though 40 hours/week;
hrs12 = mb12h + 40*mb127;
*number of weeks with missing info.;
hrs12n3 = mb12hn3;

**now second quarter after birth;
**weeks worked second quarter after birth;
wks13 = mb13 + mb137;
*number of weeks with missing info.;
wks1303 = mb130 + mb133;
**number of hours worked;
**note, for military, I'm treating as though 40 hours/week;
hrs13 = mb13h + 40*mb137;
*number of weeks with missing info.;
hrs13n3 = mb13hn3;

**now first six months;
**weeks worked first six months after birth;
wks26 = mb26 + mb267;
*number of weeks with missing info.;
wks2603 = mb260 + mb263;
**number of hours worked;
**note, for military, I'm treating as though 40 hours/week;
hrs26 = mb26h + 40*mb267;
*number of weeks with missing info.;
hrs26n3 = mb26hn3;

**now second six months;
**weeks worked second six months after birth;
wks52 = mb52 + mb527;
*number of weeks with missing info.;
wks5203 = mb520 + mb523;
**number of hours worked;
**note, for military, I'm treating as though 40 hours/week;
hrs52 = mb52h + 40*mb527;
*number of weeks with missing info.;
hrs52n3 = mb52hn3;


**next, merge into big data set;


proc means;
run;
